<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Mahally</title>
    <link rel="stylesheet" href="<?php bloginfo ('stylesheet_url') ;?>"  />
    <script src="<?php echo get_template_directory_uri ();?>/js/jquery-1.8.3.min.js"></script>
    <? //wp_head(); ?>
    
	<script type="text/javascript" src="<?php echo get_template_directory_uri ();?>/js/external/jquery.easing.1.3.min.js"></script>
    <script type="text/javascript" src="<?php echo get_template_directory_uri ();?>/js/external/jquery.mousewheel.min.js"></script>

    <!-- Slider Kit scripts -->
    <script type="text/javascript" src="<?php echo get_template_directory_uri ();?>/js/sliderkit/jquery.sliderkit.1.9.2.pack.js"></script>
    <script type="text/javascript" src="<?php echo get_template_directory_uri ();?>/js/sliderkit/addons/sliderkit.counter.1.0.pack.js"></script>
    <script type="text/javascript" src="<?php echo get_template_directory_uri ();?>/js/sliderkit/addons/sliderkit.imagefx.1.0.pack.js"></script>
    <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <!-- jQuery Plugin scripts -->
	<!--<script src="<?php echo get_template_directory_uri ();?>/js/prototype.js"></script>
    <script src="<?php echo get_template_directory_uri ();?>/js/calendarview.js"></script>-->
    <script type="text/javascript">
		$(function () {
			var events = [ 
			<?php
							$category_id = get_cat_ID('events');
							//echo $category_id;
							$args = array( 'category' => $category_id  ,'numberposts'     => -1 ,'post_status'     => 'any',);
							$lastposts = get_posts( $args );
							foreach($lastposts as $post) : setup_postdata($post); ?>
				{ Title: "<?php the_permalink(); ?>", Date: new Date("<? the_time('m/d/Y'); ?>") },
				<?php endforeach; ?> 
				
			];
			
			$("#calendar").datepicker({
				beforeShowDay: function(date) {
					var result = [true, '', null];
					var matching = $.grep(events, function(event) {
						return event.Date.valueOf() === date.valueOf();
					});
					
					if (matching.length) {
						result = [true, 'highlight', null];
					}
					return result;
				},
				onSelect: function(dateText) {
					var date,
						selectedDate = new Date(dateText),
						i = 0,
						event = null;
					
					while (i < events.length && !event) {
						date = events[i].Date;
			
						if (selectedDate.valueOf() === date.valueOf()) {
							event = events[i];
						}
						i++;
					}
					if (event) {
						window.location.href = event.Title;
					}
				}
			});
		});
	  $(window).load(function(){ //$(window).load() must be used instead of $(document).ready() because of Webkit compatibility
				
				/*---------------------------------
				 * Photo gallery > Standard
				 *---------------------------------*/
				 
				 $(".carousel-demo2").sliderkit({
					shownavitems:1,
					scroll:1,
					mousewheel:true,
					circular:true,
					start:1,
					auto: false
				});
				
				$(".photosgallery-std").sliderkit({
					mousewheel:true,
					shownavitems:4,
					panelbtnshover:false,
					auto:false,
					navscrollatend:false,
					counter:false
				});
				$(".contentslider-std").sliderkit({
					auto:0,
					tabs:1,
					circular:1,
					panelfx:"sliding",
					panelfxfirst:"fading",
					panelfxeasing:"easeInOutExpo",
					fastchange:0,
					keyboard:1
				});
				/*---------------------------------
				 *	Extending
				 *---------------------------------*/	
				
				// Get the sliderkit object data
				var myGallery = $( '.photosgallery-std' ).data( 'sliderkit' );
				
				//	External pagination
				//	----------------------
				  
					var myPaginStr = '';
					var myPaginCount = 0;
					
					// Building the pagination tag
					$( 'li', myGallery.navUL).each(function(){
						myPaginStr += '<li><a href="#" rel="'+myPaginCount+'">'+ (myPaginCount+x) +'</a></li>';
						myPaginCount++;
					});
					myGallery.domObj.before('<div id="myPagination1" class="sliderkit-pagination"><ul>'+myPaginStr+'</ul></div>');

					// Selecting first item
					var myPaginTag = $( '#myPagination1' ),
						myPaginItems = $( 'li', myPaginTag );
					myPaginItems.eq( myGallery.options.start ).addClass( 'selected' );
					
					// Pagination items click event
					$( 'a', myPaginTag ).click(function(){
						var $a = $(this);
						if( ! $a.parent().hasClass( 'selected' ) ){
							myGallery.changeWithId( $a.attr( 'rel' ) );
						}
						return false;
					});

					// Selecting current pagination item
					myGallery.options.panelfxbefore = function(){
						myPaginItems.removeClass( 'selected' );
						myPaginItems.eq( myGallery.currId ).addClass( 'selected' );
					}
					
				//	Play/Pause button
				//	----------------------

					$( '#playbtn' ).click(function(){
						if(myGallery.isPlaying!=null){
							myGallery.autoScrollStop();
						}
						else{
							myGallery.autoScrollStart();
							myGallery._autoScrollHoverStop();
						}
						return false;
					});
					
				
				//	Start slide button
				//	----------------------
				
					$( '#startslide' ).click(function(){
						// The sliding effect requires a wrapper around the panels
						myGallery._wrapPanels();
						myGallery.imageFx.remove();

						// Set the transition effect to 'sliding'
						myGallery.options.panelfx = 'sliding';
						
						// Change easing							
						myGallery.options.panelfxeasing = 'easeInOutExpo';
						
						// restart
						myGallery.stepForward();

						// Stops the click
						return false;
					});
					
					$( '#startfancy' ).click(function(){
						myGallery.options.panelfx = 'fancy';
						myGallery.options.imagefx = {fxType:'random'};
						myGallery.imageFx.init();
						return false;
					});
			});
		$(function () {$('.page-title').hide();} );
    </script>
    <? //wp_head (); ?>
    </head><body>